package com.naizhuai.ui;

import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.naizhuai.R;
import com.naizhuai.network.NetWorkObserver;
import com.naizhuai.ui.adapter.GridSpacingItemDecoration;
import com.naizhuai.ui.entity.NormalQAPage;
import com.naizhuai.ui.task.TaskActionApiIml;
import com.naizhuai.ui.task.adapter.TaskTypeAdapter;

import butterknife.BindView;
import butterknife.ButterKnife;

public class NullActivity extends BaseActivity {
    private static final int COLUMN = 4;
    @BindView(R.id.recycle_view)
    RecyclerView recycleView;
    private TaskTypeAdapter mTaskCircleTypeAdapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);
        TaskActionApiIml.getInstance().normal_question_page("","")
                                      .subscribe(new NetWorkObserver<NormalQAPage>() {
                                          @Override
                                          protected void onFail(String errormsg) {

                                          }

                                          @Override
                                          protected void onSuccess(NormalQAPage result) {
                                              mTaskCircleTypeAdapter.setTypeList(result.circleTypeList);
                                          }
                                      });
        mTaskCircleTypeAdapter = new TaskTypeAdapter();
        mTaskCircleTypeAdapter.setSelected(TaskTypeAdapter.SERIALSELECTED);
        GridLayoutManager layoutManager = new GridLayoutManager(this, COLUMN, GridLayoutManager.VERTICAL, false);
        recycleView.setNestedScrollingEnabled(false);
        recycleView.setLayoutManager(layoutManager);
        recycleView.addItemDecoration(new GridSpacingItemDecoration(COLUMN, getResources().getDimensionPixelSize(R.dimen.padding_default_min), false));
        recycleView.setAdapter(mTaskCircleTypeAdapter);
    }


    @Override
    public int getLayoutId() {
        return R.layout.nulldemo;
    }


}
